package com.earthea.common.system;

import com.earthea.common.system.server.SysFile;
import org.junit.Test;

public class ServerTest {

    @Test
    public void test() {
        Server server = new Server();
        System.out.println("------------- CPU ---------------");
        System.out.println("核心数:" + server.getCpu().getCpuNum());
        System.out.println("用户使用率:" + server.getCpu().getUsed());
        System.out.println("系统使用率:" + server.getCpu().getSys());
        System.out.println("当前空闲率:" + server.getCpu().getFree());

        System.out.println("------------- 内存 ---------------");
        System.out.println("总内存:" + server.getMem().getTotal());
        System.out.println("已用内存:" + server.getMem().getUsed());
        System.out.println("剩余内存:" + server.getMem().getFree());
        System.out.println("使用率:" + server.getMem().getUsage());

        System.out.println("------------- JVM ---------------");
        System.out.println("总内存:" + server.getJvm().getTotal());
        System.out.println("已用内存:" + server.getJvm().getUsed());
        System.out.println("剩余内存:" + server.getJvm().getFree());
        System.out.println("使用率:" + server.getJvm().getUsage());
        System.out.println("Java名称:" + server.getJvm().getName());
        System.out.println("Java版本:" + server.getJvm().getVersion());
        System.out.println("启动时间:" + server.getJvm().getStartTime());
        System.out.println("运行时长:" + server.getJvm().getRunTime());
        System.out.println("安装路径:" + server.getJvm().getHome());
        System.out.println("运行参数:" + server.getJvm().getInputArgs());

        System.out.println("------------- 系统 ---------------");
        System.out.println("服务器名称:" + server.getSys().getComputerName());
        System.out.println("操作系统:" + server.getSys().getOsName());
        System.out.println("服务器IP:" + server.getSys().getComputerIp());
        System.out.println("系统架构:" + server.getSys().getOsArch());
        System.out.println("项目路径:" + server.getSys().getUserDir());

        System.out.println("------------- 磁盘 ---------------");
        for (SysFile sysFile : server.getSysFiles()) {
            System.out.println("盘符路径:" + sysFile.getDirName());
            System.out.println("文件系统:" + sysFile.getSysTypeName());
            System.out.println("盘符类型:" + sysFile.getTypeName());
            System.out.println("总大小:" + sysFile.getTotal());
            System.out.println("可用大小:" + sysFile.getFree());
            System.out.println("已用大小:" + sysFile.getUsed());
            System.out.println("已用百分比:" + sysFile.getUsage());
        }
        System.out.println("------------- 计算机相关信息 ---------------");
        System.out.println("制造商:" + server.getComputerSystem().getManufacturer());
        System.out.println("版本:" + server.getComputerSystem().getBaseboard().getVersion());
        System.out.println("模型:" + server.getComputerSystem().getModel());
        System.out.println("防火墙：" + server.getComputerSystem().getFirmware());
        System.out.println("硬件ID：" + server.getComputerSystem().getHardwareUUID());
        System.out.println("序列号：" + server.getComputerSystem().getSerialNumber());
    }

}